<template>
  <el-popover popper-class="p-0" placement="top" trigger="hover">
    <div style="padding: 15px 16px">
      <div class="t-center" style="margin-bottom: 15px">效果示例</div>
      <div v-if="tipsType == 'wx_h5'" class="tip-box">
        <i class="icon icon-avatar"></i>
        <div class="message-box d-flex al-end fs-xs">
          <div class="share-title t-ellipsis">{{ shareTitle }}</div>
          <div class="share-desc t-light">{{ shareDesc }}</div>
          <img class="share-cover" :src="$staticRes(shareCover)" alt="封面图" />
        </div>
      </div>
      <div v-else-if="tipsType == 'wx_appLittle'" class="appLittle-tip-box">
        <i class="icon icon-avatar"></i>
        <div class="message-box d-flex al-end fs-xs">
          <div class="share-title t-ellipsis">{{ shareTitle }}</div>
          <img class="share-cover" :src="$staticRes(shareCover)" alt="封面图" />
          <div class="point"></div>
          <div class="type-name">小程序</div>
        </div>
      </div>
      <div v-else-if="tipsType == 'tail'" class="tail-tip-box">
        <div class="message-box">
          <img class="tail-img" :src="$staticRes(shareCover)" alt="开屏图" />
        </div>
      </div>
    </div>
    <div slot="reference" class="d-flex al-center mb-12 t-theme pointer">
      <i class="icon icon-view mr-4"></i>效果示例
    </div>
  </el-popover>
</template>

<script>
  export default {
    props: {
      shareTitle: { type: String, default: '' },
      shareDesc: { type: String, default: '' },
      shareCover: { type: String, default: '' },
      tipsType: {
        type: String,
        default: 'wx_h5'
      }
    }
  };
</script>

<style lang="scss" scoped>
  .icon-view {
    width: 14px;
    height: 14px;
    @include bg('icons/icon-view-cur.png');
  }

  .appLittle-tip-box {
    position: relative;
    width: 160px;
    height: 195px;
    @include bg('marketing/productEdit/appLittle-bg-share-tip.png');

    .message-box {
      position: absolute;
      top: 46px;
      left: 33px;
      border-radius: 2px;
      width: 86px;
      height: 104px;
      background-color: #fff;

      .share-title {
        font-size: 6px;
        font-weight: 400;
        line-height: 6px;
        color: #333;
      }

      .share-cover {
        position: absolute;
        bottom: 13px;
        left: 50%;
        width: 74px;
        height: 75px;
        transform: translateX(-50%);
      }
    }

    .point {
      position: absolute;
      bottom: 6px;
      left: 6px;
      border-radius: 50%;
      width: 4px;
      height: 4px;
      background: #bea7dc;
    }

    .type-name {
      position: absolute;
      bottom: 7px;
      left: 4px;
      font-size: 4px;
      font-weight: 400;
      line-height: 4px;
      color: #999;
      transform: scale(0.5);
    }
  }

  .tail-tip-box {
    .message-box {
      position: relative;
      top: 0;
      left: 0;
      width: 160px;
      height: 323px;
      @include bg('marketing/productEdit/tail_bg.png');

      .tail-img {
        position: absolute;
        top: 40px;
        left: 9px;
        border-bottom-right-radius: 20px;
        border-bottom-left-radius: 20px;
        width: 142px;
        height: 274px;
      }
    }
  }

  .tip-box {
    position: relative;
    width: 160px;
    height: 167px;
    @include bg('marketing/productEdit/bg-share-tip.png');
  }

  .icon-avatar {
    position: absolute;
    top: 46px;
    right: 8px;
    width: 24px;
    height: 24px;
    @include bg('marketing/productEdit/icons/icon-avatar.png');
  }

  .message-box {
    position: absolute;
    top: 46px;
    left: 33px;
    border-radius: 2px;
    width: 86px;
    height: 46px;
    background-color: #fff;

    &::after {
      position: absolute;
      top: 8px;
      right: -4px;
      display: block;
      border-width: 5px 0 5px 4px;
      border-style: solid;
      border-color: transparent transparent transparent #fff;
      width: 0;
      height: 0;
      content: '';
    }

    .share-cover {
      position: absolute;
      right: 6px;
      bottom: 6px;
      width: 24px;
      height: 24px;
    }

    .share-title {
      position: absolute;
      top: 0;
      top: 6px;
      left: 6px;
      width: 100%;
      transform: scale(0.6);
      transform-origin: top left;
    }

    .share-desc {
      position: absolute;
      top: 18px;
      left: 6px;
      width: 100%;
      transform: scale(0.5);
      transform-origin: top left;
      @include t-ellipsis(2);
    }
  }
</style>
